package com.parsechina.hpush.broker.internal.message;

import com.parsechina.hpush.broker.parser.ConnectMessage;

/**
 * @author linfeng
 * @since 2016/12/9
 */
public class NotifyConnectMessage extends NotifyAbstractMessage {

    private static final long serialVersionUID = 7400616005749465111L;
    private final String clientId;
    private final int keepAlive;
    private final int protocolVersion;
    private final int willQos;
    private final boolean userFlag;
    private final boolean passwordFlag;
    private final boolean willFlag;
    private final String username;
    private final String password;
    private final String willMessage;
    private final String willTopic;
    private final boolean willRetain;
    private final boolean cleanSession;

    public NotifyConnectMessage(ConnectMessage connectMessage) {
        super(NotifyType.CONNECT);
        this.cleanSession = connectMessage.isCleanSession();
        this.clientId = connectMessage.getClientId();
        this.protocolVersion = connectMessage.getProtocolVersion();
        this.userFlag = connectMessage.isUserFlag();
        this.passwordFlag = connectMessage.isPasswordFlag();
        this.username = connectMessage.getUsername();
        this.password = connectMessage.getPassword();
        this.keepAlive = connectMessage.getKeepAlive();
        this.willFlag = connectMessage.isWillFlag();
        this.willQos = connectMessage.getWillQos();
        this.willMessage = connectMessage.getWillMessage();
        this.willTopic = connectMessage.getWillTopic();
        this.willRetain = connectMessage.isWillRetain();
    }

    public String getClientId() {
        return clientId;
    }

    public int getKeepAlive() {
        return keepAlive;
    }

    public int getProtocolVersion() {
        return protocolVersion;
    }

    public int getWillQos() {
        return willQos;
    }

    public boolean isUserFlag() {
        return userFlag;
    }

    public boolean isPasswordFlag() {
        return passwordFlag;
    }

    public boolean isWillFlag() {
        return willFlag;
    }

    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password;
    }

    public String getWillMessage() {
        return willMessage;
    }

    public String getWillTopic() {
        return willTopic;
    }

    public boolean isWillRetain() {
        return willRetain;
    }

    public boolean isCleanSession() {
        return cleanSession;
    }
}
